import java.sql.*;
import com.pointbase.jdbc.jdbcInOutDoubleWrapper;

//StoredRoutines
public class StoredRoutines {
	private Connection connection;
	
	public StoredRoutines(Connection connection){
		this.connection = connection;	
	}
	
	public void CountAllOrdersSum(String status, jdbcInOutDoubleWrapper sum) throws SQLException {
		Statement statement = connection.createStatement();
		ResultSet resultSet = statement.executeQuery
			("		select sum(order_items.quantity*catalog_items.price) from orders,catalog_items,order_items " +
			"		where catalog_items.sku=order_items.sku and " +
			"		order_items.orderid=orders.orderid and " +
			"		orders.status='" + status + "'" 
			);
	
		resultSet.next();
		sum.set(resultSet.getDouble(1));
	}
}
